package com.gitee.wsl.mathematics.geometry.d2.contour.ext

import com.gitee.wsl.mathematics.geometry.d2.contour.ContourShape
import com.gitee.wsl.mathematics.geometry.d2.contour.ShapeContour
import com.gitee.wsl.mathematics.geometry.d2.contour.segment.Segment2D
import com.gitee.wsl.mathematics.geometry.d2.rect.Rectangle
import com.gitee.wsl.mathematics.geometry.d2.rect.ext.bounds

import kotlin.jvm.JvmName

/**
 * Evaluates the bounds around all [ShapeContour] instances in the [Iterable]
 */

val Iterable<ShapeContour>.bounds : Rectangle
    @JvmName("shapeContourBounds")
    get() = map {
        it.bounds
    }.bounds

/**
 * Evaluates the bounds around all [ContourShape] instances in the [Iterable]
 */
val Iterable<ContourShape>.bounds : Rectangle
    @JvmName("shapeBounds")
    get() = map {
        it.bounds
    }.bounds


/**
 * Evaluates the bounds around all [Segment] instances in the [Iterable]
 */
val Iterable<Segment2D>.bounds : Rectangle
    @JvmName("segmentBounds")
    get() = map {
        it.getBounds()
    }.bounds